<!-- templates/common/include.html -->
<!DOCTYPE html>
<html lang="en"
      manifest="cache.manifest"
      xmlns:th="http://www.thymeleaf.org">

<!-- header -->
<head th:fragment="header(title)">
    <meta charset="utf-8">
    <!-- IDEA tip:Wrong attribute value use manifest="cache.manifest"
    <meta http-equiv="Cache-Control" content="no-cache,must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${title}"></title>
    <link th:href="@{/js/v3/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/js/v3/bootstrap-table.min.css}" rel="stylesheet">
    <style></style>
</head>

<!-- footer -->
<div th:fragment="footer">
    <script th:src="@{/js/v3/jquery-2.1.4.min.js}"></script>
    <script th:src="@{/js/v3/jquery.i18n.properties.js}"></script>
    <script th:src="@{/js/v3/bootstrap.min.js}"></script>
    <script th:src="@{/js/v3/bootstrap-table.min.js}"></script>
    <!--<script th:src="@{/js/v3/bootstrap-table-zh-CN.min.js}"></script>-->
    <script th:inline="javascript">
        var ctx = /*[[@{/}]]*/'';
        var ctxPath = /*[[@{/}]]*/'';
        var ctxPath2 =[[${#httpServletRequest.getContextPath()}]];
        var basePath = [[${#httpServletRequest.getScheme() + "://" + #httpServletRequest.getServerName() + ":" + #httpServletRequest.getServerPort() + #httpServletRequest.getContextPath()}]];
        console.log("ctx:"+ctx+" ctxPath:"+ctxPath+" ctxPath2:"+ctxPath2+" basePath:"+basePath);

        // initLang
        function initLang() {
            $.i18n.properties({
                async: false
                ,name: 'strings'
                ,path: ctx+'i18n/'
                ,mode: 'both'  // both map
                ,cache: false
                ,encoding: 'UTF-8'
                ,language:  "zh_CN"
                ,callback:function () {
                    $("[data-locale-html]").each(function() {
                        var attr = $(this).data("locale-html");
                        if(attr){
                            $(this).html($.i18n.prop(attr));
                        }
                    });
                    $("[data-locale-append]").each(function() {
                        var attr = $(this).data("locale-append");
                        if(attr){
                            $(this).append($.i18n.prop(attr));
                        }
                    });
                    $("input").each(function () {
                        var attr = $(this).attr('placeholder');
                        if(attr){
                            $(this).attr('placeholder',$.i18n.prop(attr))
                        }
                    });
                    $("[data-locale-title]").each(function() {
                        var attr = $(this).data("locale-title");
                        if(attr){
                            $(this).attr("title", $.i18n.prop(attr));
                        }
                    });
                }
            });
        }
    </script>
</div>

</html>

<!--
USAGE
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="common/include :: header('cep')" />
</head>

<body>
    <th:block th:include="common/include :: footer" />
</body>
</html>
 -->
<!--
 Spring Boot Thymeleaf  自动刷新,不需要devtools,java文件变更自动加载需要devtools
 1.application.properties add:spring.thymeleaf.cache=false
 2.IDEA File-Settings - Build,Execution,Deployment - Compiler - <勾选:Build project automatically>
 3.IDEA Ctrl+Alt+Shift+/ - 1.Registry - <勾选:compiler.automake.allow.when.app.running>
 -->